package com.oa.company.service.impl;


import com.oa.company.mapper.CompanyMapper;
import com.oa.company.service.CompanyService;


import com.oa.oaspccommon.po.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zd
 * @date 2021年04月14日 15:09
 */
@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired(required = false)
    private CompanyMapper companyMapper;


    @Override
    public List<Company> findAll() {
        return companyMapper.findAll();
    }

    @Override
    public int addCompany(Company company) {
        try {
            companyMapper.addCompany(company);
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int updateCompany(Company company) {
        try {
            companyMapper.updateCompany(company);
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public Company findOne(Integer cid) {
        return companyMapper.findOne(cid);
    }
}
